VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "comctl32.ocx"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Object = "{736A8444-E374-41A8-B526-1B07FD2F3F5B}#1.0#0"; "BLacKPeaRLOCX.ocx"
Begin VB.Form FrmStatus 
   BackColor       =   &H00000000&
   BorderStyle     =   0  'None
   Caption         =   "Status Koneksi Client"
   ClientHeight    =   8400
   ClientLeft      =   0
   ClientTop       =   30
   ClientWidth     =   5280
   Icon            =   "FrmStatus.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   8400
   ScaleWidth      =   5280
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin BLacKPeaRLOCX.BLacKFrame BLacKFrame1 
      Height          =   8415
      Left            =   0
      TabIndex        =   6
      Top             =   0
      Width           =   5295
      _ExtentX        =   9340
      _ExtentY        =   14843
      BackColor1      =   0
      BackColor2      =   4210752
      Caption         =   "Registered Address"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   49152
      TitleColor1     =   0
      TitleColor2     =   4210752
      TitleGradient   =   2
      TitleHeight     =   350
      BorderColor     =   49152
      BorderWidth     =   2
      Begin BLacKPeaRLOCX.BLacKFrame Framesend 
         Height          =   4095
         Left            =   600
         TabIndex        =   8
         Top             =   1680
         Visible         =   0   'False
         Width           =   3615
         _ExtentX        =   6376
         _ExtentY        =   7223
         BackColor1      =   0
         BackColor2      =   0
         BackGradient    =   0
         Caption         =   ""
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   49152
         TitleColor1     =   2565927
         TitleColor2     =   2565927
         TitleGradient   =   0
         TitleHeight     =   350
         BorderColor     =   49152
         BorderWidth     =   2
         Begin MSComDlg.CommonDialog cmdlg 
            Left            =   0
            Top             =   0
            _ExtentX        =   847
            _ExtentY        =   847
            _Version        =   393216
         End
         Begin BLacKPeaRLOCX.ButtonNix cmdbrows 
            Height          =   285
            Left            =   2880
            TabIndex        =   2
            Top             =   3120
            Width           =   495
            _ExtentX        =   873
            _ExtentY        =   503
            BTYPE           =   5
            TX              =   "..."
            ENAB            =   -1  'True
            BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            COLTYPE         =   2
            FOCUSR          =   0   'False
            BCOL            =   1184274
            BCOLO           =   16777215
            FCOL            =   49152
            FCOLO           =   49152
            MCOL            =   12632256
            MPTR            =   1
            MICON           =   "FrmStatus.frx":B532
            UMCOL           =   -1  'True
            SOFT            =   0   'False
            PICPOS          =   0
            NGREY           =   0   'False
            FX              =   0
            HAND            =   0   'False
            CHECK           =   0   'False
            VALUE           =   0   'False
         End
         Begin VB.TextBox Txtno_client 
            Alignment       =   2  'Center
            Height          =   285
            Left            =   120
            Locked          =   -1  'True
            TabIndex        =   0
            Top             =   3120
            Width           =   495
         End
         Begin VB.TextBox txtpath 
            Height          =   285
            Left            =   720
            Locked          =   -1  'True
            TabIndex        =   1
            Top             =   3120
            Width           =   2150
         End
         Begin BLacKPeaRLOCX.ButtonNix cmmdback 
            Height          =   375
            Left            =   2160
            TabIndex        =   4
            Top             =   3480
            Width           =   1215
            _ExtentX        =   2143
            _ExtentY        =   661
            BTYPE           =   5
            TX              =   "Tutup"
            ENAB            =   -1  'True
            BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            COLTYPE         =   2
            FOCUSR          =   0   'False
            BCOL            =   1184274
            BCOLO           =   16777215
            FCOL            =   49152
            FCOLO           =   49152
            MCOL            =   12632256
            MPTR            =   1
            MICON           =   "FrmStatus.frx":B54E
            UMCOL           =   -1  'True
            SOFT            =   0   'False
            PICPOS          =   0
            NGREY           =   0   'False
            FX              =   0
            HAND            =   0   'False
            CHECK           =   0   'False
            VALUE           =   0   'False
         End
         Begin BLacKPeaRLOCX.ButtonNix cmdOK 
            Height          =   375
            Left            =   720
            TabIndex        =   3
            Top             =   3480
            Width           =   1215
            _ExtentX        =   2143
            _ExtentY        =   661
            BTYPE           =   5
            TX              =   "Kirim"
            ENAB            =   -1  'True
            BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            COLTYPE         =   2
            FOCUSR          =   0   'False
            BCOL            =   1184274
            BCOLO           =   16777215
            FCOL            =   49152
            FCOLO           =   49152
            MCOL            =   12632256
            MPTR            =   1
            MICON           =   "FrmStatus.frx":B56A
            UMCOL           =   -1  'True
            SOFT            =   0   'False
            PICPOS          =   0
            NGREY           =   0   'False
            FX              =   0
            HAND            =   0   'False
            CHECK           =   0   'False
            VALUE           =   0   'False
         End
         Begin VB.Image Foto 
            Height          =   2775
            Left            =   120
            Stretch         =   -1  'True
            Top             =   120
            Width           =   3375
         End
      End
      Begin ComctlLib.ListView ListStatus 
         Height          =   7215
         Left            =   240
         TabIndex        =   7
         Top             =   480
         Width           =   4815
         _ExtentX        =   8493
         _ExtentY        =   12726
         View            =   3
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         _Version        =   327682
         ForeColor       =   49152
         BackColor       =   0
         BorderStyle     =   1
         Appearance      =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "OCR A Extended"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         NumItems        =   4
         BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            Key             =   ""
            Object.Tag             =   ""
            Text            =   "No."
            Object.Width           =   2540
         EndProperty
         BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            SubItemIndex    =   1
            Key             =   ""
            Object.Tag             =   ""
            Text            =   "No. Client"
            Object.Width           =   2540
         EndProperty
         BeginProperty ColumnHeader(3) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            SubItemIndex    =   2
            Key             =   ""
            Object.Tag             =   ""
            Text            =   "Status"
            Object.Width           =   2540
         EndProperty
         BeginProperty ColumnHeader(4) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            SubItemIndex    =   3
            Key             =   ""
            Object.Tag             =   ""
            Text            =   "port"
            Object.Width           =   0
         EndProperty
      End
      Begin BLacKPeaRLOCX.ButtonNix CmdBatal 
         Height          =   375
         Left            =   3840
         TabIndex        =   5
         Top             =   7800
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   661
         BTYPE           =   5
         TX              =   "Tutup"
         ENAB            =   -1  'True
         BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         COLTYPE         =   2
         FOCUSR          =   0   'False
         BCOL            =   1184274
         BCOLO           =   16777215
         FCOL            =   49152
         FCOLO           =   49152
         MCOL            =   12632256
         MPTR            =   1
         MICON           =   "FrmStatus.frx":B586
         UMCOL           =   -1  'True
         SOFT            =   0   'False
         PICPOS          =   0
         NGREY           =   0   'False
         FX              =   0
         HAND            =   0   'False
         CHECK           =   0   'False
         VALUE           =   0   'False
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "*Change Background Client: Klik kanan pada Kolom no. Status Client harus terhubung dan ukuran file max 500 kb."
         ForeColor       =   &H00FFFFFF&
         Height          =   615
         Left            =   240
         TabIndex        =   9
         Top             =   7680
         Width           =   3375
      End
   End
End
Attribute VB_Name = "FrmStatus"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Status(1 To ClientMax) As String
Dim conrem As New ADODB.Connection
Dim recrem As New ADODB.Recordset
Dim remstream As New ADODB.Stream

Private Sub InitStatus()
On Error Resume Next
    For i = 1 To ClientMax
        Call CekStatus(i)
        Set lstItem = ListStatus.ListItems.Add(, , i)
        lstItem.SubItems(1) = "WStation" & i
        lstItem.SubItems(2) = Status(i)
        lstItem.SubItems(3) = i
    Next i
End Sub
Private Sub CekStatus(ByVal No_Client As Integer)
'On Error GoTo hell
    rec.Open "SELECT ip.no_client,port.ip FROM ip,port WHERE ip.ip = port.ip AND ip.no_client = " & No_Client, conn, adOpenStatic, adLockOptimistic
    If rec.RecordCount > 0 Then
        Status(No_Client) = "Connected"
    Else
        Status(No_Client) = "Disconnected"
    End If
    rec.Close
'IfNoErr:
'Exit Sub
'hell:
''MsgBox "An Error In " & Me.Name & ". See Error.log for detail", vbCritical, "Error Handling"
' TulisError Err.Description, Err.Number, "CekStatus", Me.Name
' Resume IfNoErr
End Sub





Private Sub CmdBatal_Click()
Unload Me
End Sub

Private Sub cmdbrows_Click()
On Error GoTo hell
cmdlg.Filter = "Semua Gambar(*.jpg)|*.jpg|"
cmdlg.ShowOpen
Set Foto.Picture = LoadPicture(cmdlg.FileName)
txtpath.Text = cmdlg.FileName
hell:
If Err.Number = 481 Then
MsgBox "Format file salah.", vbInformation, "Wrong Format"
End If
End Sub

Private Sub cmdOK_Click()
On Error GoTo hell
remstream.Type = adTypeBinary

recrem.Open "select rem.* from rem where rem.noclient='" & Txtno_client.Text & "'", conn, adOpenStatic, adLockOptimistic
If recrem.RecordCount = 1 Then
remstream.Open
remstream.LoadFromFile txtpath.Text
recrem(0) = Txtno_client.Text
recrem(2) = remstream.Read
remstream.Close
recrem.Update
recrem.Close
sentimg
MsgBox "Gambar telak dikirim.", vbInformation, "Sent"
Framesend.Visible = False
Else
recrem.AddNew
remstream.Open
remstream.LoadFromFile txtpath.Text
recrem(0) = Txtno_client.Text
recrem(1) = "127.0.0.1"
recrem(2) = remstream.Read
remstream.Close
recrem.Update
recrem.Close
sentimg
MsgBox "Gambar telak dikirim.", vbInformation, "Sent"
Framesend.Visible = False
End If

hell:
If Err.Number = -2147217887 Then
MsgBox "Ukuran gambar terlalu besar, maksimal 500kb. program akan berhenti, jalankan program kembali.", vbCritical, "Fatal error, Image too large"
End
End If
End Sub

Private Sub cmmdback_Click()
Framesend.Visible = False
End Sub

Private Sub Form_Load()
    Call AturList
    Call InitStatus
    StyleS
End Sub

Private Sub AturList()
    ListStatus.ColumnHeaders(1).Width = 500
    ListStatus.ColumnHeaders(2).Width = 1500
    ListStatus.ColumnHeaders(3).Width = 1500
End Sub

Private Sub StyleS()
On Error Resume Next
Dim ctrl As Control
For Each ctrl In Controls
If FrmStyles.txtnamastyle.Text = "Default" Then
Exit Sub
Else
    If (TypeOf ctrl Is ButtonNix) And _
        ctrl.Name <> "cmdSwitchStyle" Then
        ctrl.ButtonType = FrmStyles.txtlButtonType.Text
        ctrl.ColorScheme = FrmStyles.txtlColorScheme.Text
        ctrl.Backcolor = FrmStyles.txtlBackcolor.Text
        ctrl.BackOver = FrmStyles.txtlBackOver.Text
        ctrl.Forecolor = FrmStyles.txtlForecolor.Text
        ctrl.ForeOver = FrmStyles.txtlForeOver.Text
       
    End If
        If (TypeOf ctrl Is BLacKFrame) And _
        ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.BackColor1 = FrmStyles.frameBackColor1.Text
         ctrl.BackColor2 = FrmStyles.frameBackColor2.Text
         ctrl.BorderColor = FrmStyles.frameBorderColor.Text
         ctrl.Forecolor = FrmStyles.frameForecolor.Text
         ctrl.TitleColor1 = FrmStyles.frameTitleColor1.Text
         ctrl.TitleColor2 = FrmStyles.frameTitleColor2.Text
         If FrmStyles.frameBackGradient.Text = 0 Then
         ctrl.BackGradient = None
         ElseIf FrmStyles.frameBackGradient.Text = 1 Then
         ctrl.BackGradient = Vertical
         ElseIf FrmStyles.frameBackGradient.Text = 2 Then
         ctrl.BackGradient = Horizontal
         End If
         
         If FrmStyles.Frametitlegradient.Text = 0 Then
         ctrl.TitleGradient = None
         ElseIf FrmStyles.Frametitlegradient.Text = 1 Then
         ctrl.TitleGradient = Vertical
         ElseIf FrmStyles.Frametitlegradient.Text = 2 Then
         ctrl.TitleGradient = Horizontal
         End If

    End If
        If (TypeOf ctrl Is BLacKText) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Forecolor = FrmStyles.TForecolor.Text
         ctrl.Backcolor = FrmStyles.TBackcolor.Text
         ctrl.BackColorMain = FrmStyles.TBackColorMain.Text
         ctrl.BorderColor = FrmStyles.TBorderColor.Text
         ctrl.FocusBackColor = FrmStyles.TFocusBackColor.Text
         ctrl.FocusBackMainColor = FrmStyles.TFocusBackMainColor.Text
         ctrl.FocusBorderColor = FrmStyles.TFocusBorderColor.Text
         ctrl.FocusForeColor = FrmStyles.TFocusForeColor.Text
    End If
        If (TypeOf ctrl Is MSFlexGrid) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Backcolor = FrmStyles.GDBackcolor.Text
         ctrl.BackColorBkg = FrmStyles.GDBackColorBkg.Text
         ctrl.BackColorSel = FrmStyles.GDBackColorSel.Text
         ctrl.BackColorFixed = FrmStyles.GDBackColorFixed.Text
         ctrl.ForeColorSel = FrmStyles.GDForeColorSel.Text
         ctrl.Forecolor = FrmStyles.GDForecolor.Text
         ctrl.ForeColorFixed = FrmStyles.GDForeColorFixed.Text
         ctrl.GridColor = FrmStyles.GDGridColor.Text
         ctrl.GridColorFixed = FrmStyles.GDGridColorFixed.Text
    End If
        If (TypeOf ctrl Is TextBox) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Forecolor = FrmStyles.lbltextfore.Text
         ctrl.Backcolor = FrmStyles.lbltextback.Text
    End If
        If (TypeOf ctrl Is ComboBox) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Forecolor = FrmStyles.cboForeColor.Text
         ctrl.Backcolor = FrmStyles.cboBackcolor.Text
    End If
        If (TypeOf ctrl Is Label) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Forecolor = FrmStyles.lblForeColor.Text
    End If
        If (TypeOf ctrl Is RichTextBox) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Backcolor = FrmStyles.RcBackcolor.Text
    End If
    
            If (TypeOf ctrl Is OptionButton) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Forecolor = FrmStyles.opForecolor.Text
         ctrl.Backcolor = FrmStyles.opBackcolor.Text
    End If
            If (TypeOf ctrl Is ListView) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Backcolor = FrmStyles.LBackColor.Text
    End If
    Me.Backcolor = FrmStyles.WFore.Text
    End If
Next ctrl
End Sub

Private Sub ListStatus_Click()
Txtno_client.Text = ListStatus.SelectedItem.SubItems(3)
End Sub

Private Sub ListStatus_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
    Dim Pt As POINTAPI
    Dim ret As Long
    RMenu = CreatePopupMenu()

    AppendMenu RMenu, MF_STRING, 1, "Send Background"
    AppendMenu RMenu, MF_SEPARATOR, 2, ByVal 0&
    AppendMenu RMenu, MF_STRING, 3, "E&xit"

    GetCursorPos Pt
    ret = TrackPopupMenuEx(RMenu, TPM_LEFTALIGN Or TPM_RETURNCMD Or TPM_RIGHTBUTTON, Pt.X, Pt.Y, Me.hWnd, ByVal 0&)
   Select Case ret
   Case 1
   If ListStatus.SelectedItem.SubItems(2) = "Disconnected" Then
   Else
Framesend.Visible = True
End If
    Case 3
  Unload Me
   End Select

   End If

End Sub

Private Sub sentimg()
    rec.Open "SELECT ip.*,port.port FROM ip,port WHERE ip.ip = port.ip AND ip.no_client = " & Val(Txtno_client.Text), conn, adOpenStatic, adLockOptimistic
        If rec.RecordCount = 0 Then
        rec.Close
        Else
        If FrmMain.Winsock(rec(2)).State = sckConnected Then
                FrmMain.Winsock(rec(2)).SendData "chngimg|_|_|_|_|_|_|"
                  rec.Close
        End If
        End If
End Sub
    

